<template>
  <div id="app">
    <nav>
      <router-link v-for="(item,idx) in navData" :key="idx" :to="item.href">{{item.title}}</router-link>
    </nav>
    <router-view></router-view>
    <router-view name="footer"></router-view>
  </div>
</template>

<script>
import { getNavData } from './api'
export default {
  name:"app",
  data() {
    return {
      navData: []
    }
  },
  created() {
    getNavData().then(res=>{
      this.navData = res.data;
    })
  },
}
</script>

<style lang="less">
*{margin:0;padding:0;}
html,body {
  height:100%;
}
#app{
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  width:100%;
  height:100%;
  display:flex;
  flex-direction: column;
  nav {
    width:100%;
    line-height: 40px;
    height:40px;
    display: flex;
    a {
      flex:1;
      text-align:center;
      font-weight: bold;
      color: #2c3e50;
      &.router-link-exact-active {
        color: #42b983;
      }
      &:hover{
        background: #f6f6f6;
      }
      &:active{
        background: #efefef;
      }
    }
  }
  .cont{
    flex:1;
    overflow: auto;
  }
  .footer{
    height:40px;
    line-height:40px;
    text-align:center;
  }
}
</style>
